home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / info_tip / vbtipday / nov.ini < prev    next >
INI File  |  1995-06-20  |  20KB  |  517 lines

  1. [1]
  2. Lines=1
  3. Line1="A very easy way to add sound to a VB project is with the Beep command."
  4. [2]
  5. Lines=6
  6. Line1="To '?' command can be used in the Debug window as a substitute for the 'Print'"
  7. Line2=" command.  For example,"
  8. Line3="<CR>"
  9. Line4="      ? LastName"
  10. Line5="<CR>"
  11. Line6="will print the value of the LastName variable."
  12. [3]
  13. Lines=2
  14. Line1="Consider making use of constants wherever possible in your code.  This will not"
  15. Line2=" only make your programs more self-documenting, but easier to modify as well."
  16. [4]
  17. Lines=6
  18. Line1="If you change the Name property of a control after you have coded an"
  19. Line2=" event for it, you must also change the name of the event to match"
  20. Line3=" the name of the control."
  21. Line4="<CR>"
  22. Line5="Note:  After changing the name of the control, any events for that control will be"
  23. Line6=" moved into the general declarations section."
  24. [5]
  25. Lines=2
  26. Line1="To clear text in a Code Window from the current cursor location to the"
  27. Line2=" end of line, press <CTRL>+<DEL>."
  28. [6]
  29. Lines=12
  30. Line1="A great source of VB articles including programming tips, product reviews, etc."
  31. Line2=" is "The Visual Basic Programmer's Journal."  Their subscription address is:"
  32. Line3="<CR>"
  33. Line4="      Visual Basic Programmer's Journal"
  34. Line5="<CR>"
  35. Line6="      P.O. Box 58872"
  36. Line7="<CR>"
  37. Line8="      Boulder, CO  80322-8872"
  38. Line9="<CR>"
  39. Line10="or call"
  40. Line11="<CR>"
  41. Line12="      303-678-0439."
  42. [7]
  43. Lines=9
  44. Line1="VB supports the following 4 program control statements:"
  45. Line2="<CR>"
  46. Line3="      Do...Loop"
  47. Line4="<CR>"
  48. Line5="      If...Then...Else"
  49. Line6="<CR>"
  50. Line7="      Select Case"
  51. Line8="<CR>"
  52. Line9="      While...Wend"
  53. [8]
  54. Lines=2
  55. Line1="If you use CompuServe, try GO VBPJFO for the Visual Basic Programmer's Journal"
  56. Line2=" forum."
  57. [9]
  58. Lines=4
  59. Line1="If you accidentally delete a control from a form, you can undelete it by"
  60. Line2=" selecting the 'Undo' menu item from the 'Edit' menu."
  61. Line3="<CR>"
  62. Line4="Note: The Undo must be done immediately following the delete."
  63. [10]
  64. Lines=2
  65. Line1="VB supports the UCase$ and LCase$ functions for converting strings to"
  66. Line2=" uppercase and lowercase respectively."
  67. [11]
  68. Lines=2
  69. Line1="To prevent a user from seeing what is typed into a text box (e.g. a"
  70. Line2=" password), set the PasswordChar property to the '*' character."
  71. [12]
  72. Lines=6
  73. Line1="To center a form on the screen, put the following two statements in the"
  74. Line2=" Form_Load event:"
  75. Line3="<CR>"
  76. Line4="      Me.Top = (Screen.Height - Me.Height) / 2"
  77. Line5="<CR>"
  78. Line6="      Me.Left = (Screen.Width - Me.Width) / 2"
  79. [13]
  80. Lines=3
  81. Line1="The Interval of the Timer property is measured in milliseconds."
  82. Line2="  A common error is to set the property to 1 for a one second"
  83. Line3=" interval.  The correct value for a 1 second interval is 1000."
  84. [14]
  85. Lines=3
  86. Line1="Comments are stripped out of an application when it is compiled.  Thus,"
  87. Line2=" comments do not increase the size of an EXE file.  Feel free to use"
  88. Line3=" as many as needed."
  89. [15]
  90. Lines=4
  91. Line1="To put multiple statements in one line of code, use the colon as a"
  92. Line2=" separator.  For example:"
  93. Line3="<CR>"
  94. Line4="      For J = 1 to 10: J = J + 1: Next J"
  95. [16]
  96. Lines=3
  97. Line1="To get Help on the syntax of VB functions, statements, properties,"
  98. Line2=" events, and methods while you are working in a Code window, click on the"
  99. Line3=" keyword and press F1."
  100. [17]
  101. Lines=1
  102. Line1="A line of VB code can not span more than one line."
  103. [18]
  104. Lines=3
  105. Line1="VB has an excellent on-line Help system.  In fact, the entire Language Reference"
  106. Line2=" Manual is on-line.  Learning how to quickly navigate and find information in"
  107. Line3=" the on-line help file will be very beneficial in the long run."
  108. [19]
  109. Lines=3
  110. Line1="The Circle method, when provided with the correct parameters can be"
  111. Line2=" used to draw an ellipse, arc, or pie wedge (an arc with radius lines drawn"
  112. Line3=" at both ends)."
  113. [20]
  114. Lines=6
  115. Line1="Consider using 'Option Explicit' to force explicit declaration of all variables used in an"
  116. Line2=" application.  You can automatically include an 'Option Explicit' statement in your code by"
  117. Line3=" selecting the 'Environment' menu item from the 'Options' menu and changing the 'Require Variable"
  118. Line4=" Declaration' option to 'Yes'."
  119. Line5="<CR>"
  120. Line6=" Note: 'Option Explicit' should appear in every form and code module in your application."
  121. [21]
  122. Lines=4
  123. Line1="You may wish to set the 'Save Project Before Run' option to 'Yes'.  This will give you"
  124. Line2=" the opportunity to save your changes before every run, thus protecting you from unsaved"
  125. Line3=" changes if the system were to crash."
  126. Line4="  This variable can be found under the 'Environment' menu item in the 'Options' menu."
  127. [22]
  128. Lines=11
  129. Line1="When creating a long string, use multiple lines of code so the string is easily readable"
  130. Line2=" without having to horizontally scroll the screen.  This technique is particularly useful"
  131. Line3=" when displaying a MsgBox, InputBox, or creating an SQL string.  For example:"
  132. Line4="<CR>"
  133. Line5="      strMsg = "This is a paragraph that is to be placed ""
  134. Line6="<CR>"
  135. Line7="      strMsg = strMsg && "in a message box.  The text is ""
  136. Line8="<CR>"
  137. Line9="      strMsg  = strMsg && "broken into several lines.""
  138. Line10="<CR>"
  139. Line11="      MsgBox strMsg"
  140. [23]
  141. Lines=3
  142. Line1="Labels have automatic word wrap so don't worry about the caption of a label"
  143. Line2=" being too long for the label's width.  However, you may have to adjust the"
  144. Line3=" height of the label."
  145. [24]
  146. Lines=2
  147. Line1="To quickly see which events have code associated with them you can look at the"
  148. Line2=" procedure list in the Code Window.  Those events that have code will appear in boldface."
  149. [25]
  150. Lines=2
  151. Line1="To make option buttons work as a group, enclose them in a frame.  The option buttons in"
  152. Line2=" a frame are separate from the rest of the option buttons on the form."
  153. [26]
  154. Lines=3
  155. Line1="Separator bars, used to separate menu items in a drop-down menu, can add clarity to"
  156. Line2=" menus.  To add a separator bar simply put the character '-' in the Caption property"
  157. Line3=" in the Menu Design Window."
  158. [27]
  159. Lines=2
  160. Line1="You can automatically resize a Label control to fit its caption by setting the AutoSize"
  161. Line2=" property of the control to 'True'."
  162. [28]
  163. Lines=2
  164. Line1="Setting the BorderStyle, ControlBox, MaxButton, and MinButton properties do not"
  165. Line2=" alter the appearance of the form until run time."
  166. [29]
  167. Lines=2
  168. Line1="If you are using the QBColor function, try the RGB function instead.  RGB provides"
  169. Line2=" the ability to generate many, many more colors."
  170. [30]
  171. Lines=3
  172. Line1="Use the drop down list box labeled 'Shortcut' in the Menu Design Window to assign"
  173. Line2=" shortcut keys to menus. This is a nice feature that allows "power users" to navigate"
  174. Line3=" quickly around the application."
  175. [31]
  176. Lines=2
  177. Line1="Using the Show and Hide methods on a form is effectively the same as setting the"
  178. Line2=" form's Visible property in code to True and False, respectively."
  179. [32]
  180. Lines=11
  181. Line1="To limit the number of controls that VB loads into the Toolbox when it is launched,"
  182. Line2=" do the following:"
  183. Line3="<CR>"
  184. Line4="    1. Open the 'AUTOLOAD.MAK' project in your VB directory."
  185. Line5="<CR>"
  186. Line6="    2. Click on any control that you do not want to load and select 'Remove File' from"
  187. Line7=" the 'File' menu."
  188. Line8="<CR>"
  189. Line9="    3. Save the project."
  190. Line10="<CR>"
  191. Line11="You may also add controls using the 'Add File' selection."
  192. [33]
  193. Lines=2
  194. Line1="Colors are customizable in the VB development environment.  To set your own colors"
  195. Line2=" select 'Environment' from the 'Options' menu."
  196. [34]
  197. Lines=2
  198. Line1="The VB statement to delete a file is 'Kill'.  Be very careful when using this statement with"
  199. Line2=" wildcard characters."
  200. [35]
  201. Lines=3
  202. Line1="Use the following syntax to raise a number to the power of an exponent:"
  203. Line2="<CR>"
  204. Line3="      I = J ^ N"
  205. [36]
  206. Lines=2
  207. Line1="Use <Ctrl> + <Down Arrow> and <Ctrl> + <Up Arrow> to move from procedure to"
  208. Line2=" procedure in a code window."
  209. [37]
  210. Lines=3
  211. Line1="Use the following statement to return the current day as a full name (Monday, Tuesday, etc.):"
  212. Line2="<CR>"
  213. Line3="      Format$(Now, "dddd")"
  214. [38]
  215. Lines=3
  216. Line1="When using the SendKeys statement, remember that it is case sensitive.  That is,"
  217. Line2=" sending <Alt>+F is different than sending <Alt>+f.  Some programs will interpret"
  218. Line3=" <Alt>+F as <Alt>+<Shift>+f."
  219. [39]
  220. Lines=2
  221. Line1="In an error handler, use the 'Resume Next' statement to cause the code to branch to"
  222. Line2=" the line after the line that generated the error."
  223. [40]
  224. Lines=1
  225. Line1="VB supports the Left$, Right$, and Mid$ commands for string manipulation."
  226. [41]
  227. Lines=3
  228. Line1="Use the following command to print 'True' or 'False' based on the value of a flag:"
  229. Line2="<CR>"
  230. Line3="      Format$(Flag,"True/False")"
  231. [42]
  232. Lines=1
  233. Line1="To get on-line help for an error press F1 when an error message box pops up."
  234. [43]
  235. Lines=2
  236. Line1="When debugging a program with many nested calls, press <CTRL> + L in break"
  237. Line2=" mode to see the list of procedure calls."
  238. [44]
  239. Lines=7
  240. Line1="Use the Chr$ command to concatenate a carriage return in a string.  For example:"
  241. Line2="<CR>"
  242. Line3="      Msg$ = "A carriage return will follow this line.""
  243. Line4="<CR>"
  244. Line5="      Msg$ = Msg$ && Chr$(10)"
  245. Line6="<CR>"
  246. Line7="      Msg$ = Msg$ && "This is the second line.""
  247. [45]
  248. Lines=2
  249. Line1="If you want to enlarge a bitmap picture on a form use the Image control and set the"
  250. Line2=" Stretch property to 'True'."
  251. [46]
  252. Lines=3
  253. Line1="Consider using a lower case, 3 letter prefix when naming your controls, e.g."
  254. Line2=" lblName, picLogo, txtEmpNbr, etc.  This will make your code more much more readable"
  255. Line3=" and maintainable."
  256. [47]
  257. Lines=2
  258. Line1="To change the placement and size of forms and controls, use the Top, Left, Width, and"
  259. Line2=" Height properties."
  260. [48]
  261. Lines=4
  262. Line1="A modal form is a type of window or dialog box that requires the user to take action"
  263. Line2=" before the user can switch to another form.  To create a modal form use the following:"
  264. Line3="<CR>"
  265. Line4="      FormName.Show 1"
  266. [49]
  267. Lines=1
  268. Line1="VB supports the Hex$ and Oct$ functions for converting numbers between notations."
  269. [50]
  270. Lines=2
  271. Line1="To keep a user from minimizing or maximizing a form, set both the MinButton and"
  272. Line2=" MaxButton properties of the form to 'False'."
  273. [51]
  274. Lines=2
  275. Line1="To keep a user from resizing a form, set the BorderStyle property of the form to"
  276. Line2=" '0-None', '1-Fixed Single', or '3-Fixed Double'."
  277. [52]
  278. Lines=3
  279. Line1="To show the current time (with hours and minutes) use the following statement:"
  280. Line2="<CR>"
  281. Line3="      Format$(Now, "Short Time")"
  282. [53]
  283. Lines=3
  284. Line1="Although you can draw graphics directly onto a form, the Line and Shape"
  285. Line2=" controls are often an easier way to add lines, circles, and squares to a"
  286. Line3=" form."
  287. [54]
  288. Lines=2
  289. Line1="To turn the mousepointer into an hourglass, set the MousePointer property of the"
  290. Line2=" Screen or Form to 11.  Set the property back to 0 to restore the mousepointer."
  291. [55]
  292. Lines=3
  293. Line1="To quickly remove all contents of a list box use the Clear method:"
  294. Line2="<CR>"
  295. Line3="      List1.Clear"
  296. [56]
  297. Lines=3
  298. Line1="To quickly remove leading and trailing spaces from a string use the Trim$ command:"
  299. Line2="<CR>"
  300. Line3="      String1$ = Trim$(String1$)"
  301. [57]
  302. Lines=1
  303. Line1="Remember, only controls that have the 'Align' property can be placed directly on an MDI form."
  304. [58]
  305. Lines=4
  306. Line1="A status bar typically appears at the bottom of MDI forms.  The status bar displays information"
  307. Line2=" about the currently selected item or the state of the application.  It can be created with a"
  308. Line3=" picture box that has its Align property set to '2'.  However, if you are using the professional"
  309. Line4=" version of VB, the 3D Panel control works much better."
  310. [59]
  311. Lines=3
  312. Line1="Controls can be moved from a form onto a frame.  To do this, click on the control and"
  313. Line2=" select 'Cut' from the 'Edit' menu.  Then click on the frame and select 'Paste' from"
  314. Line3=" the 'Edit' menu."
  315. [60]
  316. Lines=1
  317. Line1="<Alt> + <F4> will close the current code window."
  318. [61]
  319. Lines=4
  320. Line1="When working with the Debug Window, cut and paste functionality if fully operable."
  321. Line2=" That is to say, you may paste a line of code into the Debug Window to execute it,"
  322. Line3=" or you may cut a line of code from the Debug Window to paste into the Code Window"
  323. Line4=" or another application."
  324. [62]
  325. Lines=4
  326. Line1="To configure VB to automatically save your changes before running your program set the"
  327. Line2=" auto save feature on.  Select the 'Environment...' menu option from the 'Options' menu."
  328. Line3="  Then set the 'Save Project Before Run' option to 'Yes'.  This is especially useful when"
  329. Line4=" working with the Windows API (which can crash the VB environment)."
  330. [63]
  331. Lines=10
  332. Line1="To prevent more than one instance of your application from running, use the following"
  333. Line2=" statements as the first lines in your program:"
  334. Line3="<CR>"
  335. Line4="      If App.PrevInstance Then"
  336. Line5="<CR>"
  337. Line6="          MsgBox "Program already loaded.""
  338. Line7="<CR>"
  339. Line8="          End "
  340. Line9="<CR>"
  341. Line10="      End If"
  342. [64]
  343. Lines=4
  344. Line1="There is a lot of information for VB programmers available on the Internet.  Check out"
  345. Line2=" Carl 'n Gary's Visual Basic Home Page located at:"
  346. Line3="<CR>"
  347. Line4="      http://www.apexsc.com/vb"
  348. [65]
  349. Lines=3
  350. Line1="To generate a date suitable for printing use the following Format statement:"
  351. Line2="<CR>"
  352. Line3="      Format$(Now, "mmmm d, yyyy")"
  353. [66]
  354. Lines=2
  355. Line1="To specify the startup form, choose the 'Project' menu item from the 'Options' menu,"
  356. Line2=" and set the 'Start Up Form' option."
  357. [67]
  358. Lines=4
  359. Line1="To pass a control property as a parameter, enclose the control and property in parentheses."
  360. Line2="  For example,"
  361. Line3="<CR>"
  362. Line4="  AddEmployee (txtEmpName.Text), (txtEmpNbr.Text)"
  363. [68]
  364. Lines=2
  365. Line1="To shift one screen to the right and left, press <CTRL>+<PAGE DOWN> and"
  366. Line2=" <CTRL>+<PAGE UP> respectively."
  367. [69]
  368. Lines=2
  369. Line1="VB has an excellent debugging facility.  Learning to efficiently use this facility"
  370. Line2=" will pay huge dividends."
  371. [70]
  372. Lines=2
  373. Line1="To quickly find text in VB press <CTRL>+F, and type in the text to search.  The radio"
  374. Line2=" buttons labeled 'Search' control the scope of the search.  Press F3 to find next."
  375. [71]
  376. Lines=2
  377. Line1="While in the Code Window, press <F2> to go to a list of all the procedures in your"
  378. Line2=" project.  From there, you can select a procedure to jump to."
  379. [72]
  380. Lines=2
  381. Line1="Review your code and remove any unused statements before making an .EXE file.  VB does"
  382. Line2=" not remove dead code and thus it unnecessarily increases the size of your .EXE file."
  383. [73]
  384. Lines=3
  385. Line1="The Caption property can be used to assign an access key to a control.  Simply"
  386. Line2=" proceed the character you want for an access key with the '&&' character.  Try this"
  387. Line3=" technique with Label controls, Command Button controls, Frame controls, etc."
  388. [74]
  389. Lines=3
  390. Line1="It is good practice to change the name of a control before you start writing any event"
  391. Line2=" procedures for it.  If you change the name after you write an event, VB will not"
  392. Line3=" rename the event properly and you will have to do so manually."
  393. [75]
  394. Lines=8
  395. Line1="One way to convert any text entered into a text box to upper case is to put the"
  396. Line2=" following code into the text box's KeyPress event:"
  397. Line3="<CR>"
  398. Line4="      If KeyAscii >= 97 And KeyAscii <= 122 Then"
  399. Line5="<CR>"
  400. Line6="            KeyAscii = KeyAscii - 32"
  401. Line7="<CR>"
  402. Line8="      End If"
  403. [76]
  404. Lines=3
  405. Line1="Use the following statement to get the full name of the current month:"
  406. Line2="<CR>"
  407. Line3="      Format$(Now, "mmmm")"
  408. [77]
  409. Lines=6
  410. Line1="To automatically select text in a text box when it gains focus, put the following"
  411. Line2=" code in the GotFocus event of the text box."
  412. Line3="<CR>"
  413. Line4="      Text1.SelStart = 0"
  414. Line5="<CR>"
  415. Line6="      Text1.SelLength = 65000"
  416. [78]
  417. Lines=3
  418. Line1="Use the following statement to format currency amounts suitable for printing:"
  419. Line2="<CR>"
  420. Line3="      Format$(GrandTotal, "Currency")"
  421. [79]
  422. Lines=1
  423. Line1="For users of CompuServe try 'GO MICROSOFT'."
  424. [80]
  425. Lines=3
  426. Line1="Use the integer data type whenever possible.  The integer data type uses less memory"
  427. Line2=" and is significantly faster for arithmetic operations than other numeric data types."
  428. Line3="  It has a range of -32,768 to 32,767"
  429. [81]
  430. Lines=2
  431. Line1="VB has a convenient Undo feature that can come in handy when code or a control"
  432. Line2=" is accidently deleted."
  433. [82]
  434. Lines=4
  435. Line1="The '\' operator can be used to perform integer division.  Note that the result"
  436. Line2=" is truncated and not rounded."
  437. Line3="<CR>"
  438. Line4="Thus, 5 \ 3 = 1."
  439. [83]
  440. Lines=4
  441. Line1="To position a top-level menu item to the right side of the menu bar simply add the"
  442. Line2=" following code to the Form_Load event:"
  443. Line3="<CR>"
  444. Line4="  mnuHelp.Caption = Chr$(8) && mnuHelp.Caption"
  445. [84]
  446. Lines=8
  447. Line1="In order to minimize memory usage, use variable-length strings rather than fixed-length"
  448. Line2=" strings wherever possible.  That is, use the declaration:"
  449. Line3="<CR>"
  450. Line4="      Dim strName As String"
  451. Line5="<CR>"
  452. Line6="rather than the declaration:"
  453. Line7="<CR>"
  454. Line8="      Dim strName As String * 20"
  455. [85]
  456. Lines=2
  457. Line1="Use the Form_QueryUnload event to determine how the user is shutting down the application."
  458. Line2="  The QueryUnload event can also be used to cancel the application's termination."
  459. [86]
  460. Lines=4
  461. Line1="You can make comments appear as though they were highlighted with a yellow marker"
  462. Line2=" by changing the 'Comment Background' Environment Option to yellow in the"
  463. Line3=" 'Environment Options' dialog box.  Choose the 'Environment...' menu item from the"
  464. Line4=" 'Options' menu to display this dialog box."
  465. [87]
  466. Lines=10
  467. Line1="You can execute code before any form loads by using a 'Sub Main' routine. To use this"
  468. Line2=" functionality perform the following 2 steps."
  469. Line3="<CR>"
  470. Line4="  1) Define a subroutine called 'Main' in a global module."
  471. Line5="<CR>"
  472. Line6="  2) Select the 'Project' menu item from the 'Options' menu and set the 'Start Up Form'"
  473. Line7=" to 'Sub Main'."
  474. Line8="<CR>"
  475. Line9="This technique can be used, among other things, to read command line variables"
  476. Line10=" and load different forms based on these variables."
  477. [88]
  478. Lines=6
  479. Line1="To simulate command line variables being passed to an executable while testing in the"
  480. Line2=" development environment, change the 'Command Line Argument' option in the 'Project"
  481. Line3=" Options' dialog box."
  482. Line4="<CR>"
  483. Line5="Note:  This dialog box is accessed by choosing the 'Project' menu item"
  484. Line6=" from the 'Options' menu."
  485. [89]
  486. Lines=5
  487. Line1="If you wish to search for a word by itself and not as part of another word (i.e. find"
  488. Line2=" all instances of the word 'Go' and not 'Goto'), check the 'Match Whole Word Only'"
  489. Line3=" check box in the 'Find' dialog box."
  490. Line4="<CR>"
  491. Line5="Note:  This option is also found in the 'Replace' dialog box."
  492. [90]
  493. Lines=7
  494. Line1="To include a double quote in a string, use two consecutive double quotes.  For example:"
  495. Line2="<CR>"
  496. Line3="      MsgBox "Type ""GO"" to proceed.""
  497. Line4="<CR>"
  498. Line5="will print the following in the message box:"
  499. Line6="<CR>"
  500. Line7="      Type "GO" to proceed."
  501. [91]
  502. Lines=11
  503. Line1="Consider using the reserved word Me when self-referencing a form.  For"
  504. Line2=" example,"
  505. Line3="<CR>"
  506. Line4="      Unload Me"
  507. Line5="<CR>"
  508. Line6="or"
  509. Line7="<CR>"
  510. Line8="      Me.Top = (Screen.Height - Me.Height) / 2"
  511. Line9="<CR>"
  512. Line10="This will make your code more portable.  Thus, copying and pasting code from"
  513. Line11=" one application to another will require fewer changes."
  514. [92]
  515. Lines=2
  516. Line1="To quickly get on-line help for a particular property, click on the property in"
  517. Line2=" the Properties Window and press F1."